<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY copy "&#169;">
  <!ENTITY nbsp "&#160;">
  <!ENTITY laquo "&#171;">
  <!ENTITY raquo "&#187;">
]>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

    <xsl:include href="../layout.xsl"/>

    <xsl:template match="/">
        <xsl:apply-templates />
    </xsl:template>
    <xsl:template match="content">
        <xsl:choose>
            <xsl:when test="$Settings/is_mobile != ''">
                <script src="/js/mobiscroll/mobiscroll.core.js" type="text/javascript"></script>
                <script src="/js/mobiscroll/mobiscroll.datetime.js" type="text/javascript"></script>
                <script src="/js/mobiscroll/mobiscroll.select.js" type="text/javascript"></script>
                <script src="/js/mobiscroll/mobiscroll.list.js" type="text/javascript"></script>
                <script src="/js/mobiscroll/mobiscroll.ios.js" type="text/javascript"></script>
                <link href="/css/mobiscroll/mobiscroll.core.css" rel="stylesheet" type="text/css" />
                <link href="/css/mobiscroll/mobiscroll.ios.css" rel="stylesheet" type="text/css" />
                <script type="text/javascript">
                        $(function(){
                            // create a datetimepicker with default settings 
                            $("#event_date").scroller({ 
                                preset: 'datetime',
                                dateFormat: 'dd.mm.yy',
                                dateOrder: 'ddmmyy',
                                timeFormat: 'HH:ii',
                                showNow: true,
                                timeWheels: 'HHii'
                            });
                        });
                </script>
            </xsl:when>
            <xsl:otherwise>
                <link href="/js/jquery-ui/css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" />
                <link href="/js/jquery-ui/css/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css" />
                <script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.18.custom.min.js"></script>
                <script type="text/javascript" src="/js/jquery-ui/jquery.ui.datetimepicker-uk.js"></script>
                <script type="text/javascript" src="/js/jquery-ui/jquery-ui-timepicker-addon.js"></script>
                <script type="text/javascript" src="/js/jquery-ui/jquery-ui-sliderAccess.js"></script>
                <script>                        
                        $(function(){
                            $("#event_date").datetimepicker();
                        });
                        
                </script>
            </xsl:otherwise>
        </xsl:choose>
        
        <div class="contenthead">
            <xsl:call-template name="Create_Path">
                <xsl:with-param name="last">
                    <xsl:text>Редактирование</xsl:text>
                </xsl:with-param>
            </xsl:call-template>
        </div>

        <div class="head-slide-container">
        <div>
            <xsl:choose>
                <xsl:when test="$User/role_id = 1">
                    <xsl:attribute name="class">head-slide on</xsl:attribute>
                </xsl:when>
                <xsl:when test="$User/role_id = 12">
                    <xsl:attribute name="class">head-slide on</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="class">head-slide off</xsl:attribute>
                </xsl:otherwise>
            </xsl:choose>
            Прием сообщения о ДТП
        </div>
        <div class="container">
            <xsl:choose>
                <xsl:when test="$User/role_id = 1">
                    <xsl:attribute name="style">display: block;</xsl:attribute>
                </xsl:when>
                <xsl:when test="$User/role_id = 12">
                    <xsl:attribute name="style">display: block;</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="style">display: none;</xsl:attribute>
                </xsl:otherwise>
            </xsl:choose>
            <form action="" method="post" name="form" id="form" enctype="multipart/form-data" >

            <div class="article">
                <xsl:call-template name="Messages" />

                <ul class="editlist">                    
                    <li>
                        <label>Тип проишествия</label>
                        <select name="event_type_id" id="event_type_id" class="field">
                            <xsl:for-each select="Main/form/id_type_event/row">
                                <option value="{id}">
                                    <xsl:if test="@active">
                                        <xsl:attribute name="selected">selected</xsl:attribute>
                                    </xsl:if>
                                    <xsl:value-of select="name" />
                                </option>
                            </xsl:for-each>
                        </select>
                    </li>
                    <li>
                        <label>Дата и время проишествия</label>
                        <input id="event_date" name="event_date" class="field" value="{$Form/event_date}"/>
                    </li>
                    <li>
                        <label>Где?</label>
                        <textarea name="place" type="text" class="field" rows="4">
                            <xsl:value-of select="Main/form/place"/>
                        </textarea>                        
                    </li>
                    <li>
                        <label>Что?</label>

                        <textarea name="short_descr" type="text" class="field" rows="4">
                            <xsl:value-of select="Main/form/short_descr"/>
                        </textarea>
                    </li>
                    <li>
                        <label>Район</label>
                        <select name="district_id" id="district_id" class="field">
                            <option value="0">
                                -- Не выбрано --
                            </option>
                            <xsl:for-each select="Main/form/district_id/row">
                                <option value="{id}">
                                    <xsl:if test="@active">
                                        <xsl:attribute name="selected">selected</xsl:attribute>
                                    </xsl:if>
                                    <xsl:value-of select="name" />
                                </option>
                            </xsl:for-each>
                        </select>
                    </li>
                    <li>
                        <label for="arrival_time">Время прибытия, мин </label>
                        <input type="number" name="arrival_time" value="{$Main/form/arrival_time}" class="field"/>
                    </li>
                    <li>
                        <label>Тип реакции</label>
                        <select name="reaction_type_id" id="reaction_type_id" class="field">
                            <option value="0">
                                -- Не выбрано --
                            </option>
                            <xsl:for-each select="Main/form/reaction_type_id/row">
                                <option value="{id}">
                                    <xsl:if test="@active">
                                        <xsl:attribute name="selected">selected</xsl:attribute>
                                    </xsl:if>
                                    <xsl:value-of select="name" />
                                </option>
                            </xsl:for-each>
                        </select>
                    </li>
                    <li>
                        <label>Пострадавшие</label>
                        <label>
                            <xsl:if test="$Settings/is_mobile = ''">
                                <xsl:attribute name="style">float:left;</xsl:attribute>
                            </xsl:if>
                            <input type="checkbox" name="is_300" id="is_300" value="1">
                                <xsl:if test="$Main/form/is_300 >0">
                                    <xsl:attribute name="checked">true</xsl:attribute>
                                </xsl:if>
                            </input>300
                        </label>
                        <label>
                            <input type="checkbox" name="is_200" id="is_200" value="1">
                                <xsl:if test="$Main/form/is_200 >0">
                                    <xsl:attribute name="checked">true</xsl:attribute>
                                </xsl:if>
                            </input>200
                        </label>                      
                    </li>
                    <li>
                        <label>На месте</label>
                        <label>
                            <xsl:if test="$Settings/is_mobile = ''">
                                <xsl:attribute name="style">float:left;</xsl:attribute>
                            </xsl:if>
                            <input type="checkbox" name="is_gai" id="is_gai" value="1">
                                <xsl:if test="$Main/form/is_gai >0">
                                    <xsl:attribute name="checked">true</xsl:attribute>
                                </xsl:if>
                            </input>ГАИ
                        </label>
                        <label>
                            <input type="checkbox" name="is_med" id="is_med" value="1">
                                <xsl:if test="$Main/form/is_med >0">
                                    <xsl:attribute name="checked">true</xsl:attribute>
                                </xsl:if>
                            </input>скорая
                        </label>                      
                    </li>
                    <li>
<!--                            <label>Рассылка</label>-->
                            <div style="float:left;">
                                <img src="{$Images}/icons/send_big.png" width="48" height="48" id="makeDistribution"/>
                            </div>
                            <div>
                                <label>
<!--                                    <xsl:if test="$Settings/is_mobile = ''">
                                        <xsl:attribute name="style">float:left;</xsl:attribute>
                                    </xsl:if>-->
                                    <input type="checkbox" id="alert_sms" value="1" checked="true"/>альфа смс
                                </label>
                                <label>
<!--                                    <xsl:if test="$Settings/is_mobile = ''">
                                        <xsl:attribute name="style">float:left;</xsl:attribute>
                                    </xsl:if>-->
                                    <input type="checkbox" id="alert_email" value="1" checked="true"/>e-mail
                                </label>
                                <label>
                                    <input type="checkbox" id="alert_motok" value="1" checked="true"/>репост на моток
                                </label>
                            </div>                  
                    </li>
                </ul>
            </div>
            <div class="submitbox">
                <input name="save" type="submit" style="font-weight: bold;" value="Save" />
                <input name="saveexit" type="submit" value="Save and exit" />
                <input type="button" value="Cancel" onclick="document.location = '/{$Controller}'"/>
                <!--alert({$Controller});-->
            </div>
        </form>
        </div>
        </div>
        <div class="head-slide-container">
        <div>
            <xsl:choose>
                <xsl:when test="$User/role_id = 1">
                    <xsl:attribute name="class">head-slide off</xsl:attribute>
                </xsl:when>
                <xsl:when test="$User/role_id = 12">
                    <xsl:attribute name="class">head-slide off</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="class">head-slide on</xsl:attribute>
                </xsl:otherwise>
            </xsl:choose>
            Отчет по ДТП
        </div>
        <div class="container">
            <xsl:choose>
                <xsl:when test="$User/role_id = 1">
                    <xsl:attribute name="style">display: none;</xsl:attribute>
                </xsl:when>
                <xsl:when test="$User/role_id = 12">
                    <xsl:attribute name="style">display: none;</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="style">display: block;</xsl:attribute>
                </xsl:otherwise>
            </xsl:choose>
            <form action="/{$Controller}" method="post" class="filter">
                <div class="article">
                    <xsl:call-template name="Messages" />
                
                <fieldset>
                    <ul class="editlist">
                        <li>
                            <label>  за ключовим словом</label>
                            <input name="search_text" type="text" value="{$Form/search_text}" class="field"/>

                        </li>
                        <li>
                            <label>Район</label>

                            <select name="id_district" id="id_district" class="field">
                                <xsl:if test="not($Form/id_district/row)">
                                    <xsl:attribute name="disabled">disabled</xsl:attribute>
                                </xsl:if>
                                <option value="0">
                                    Не задано
                                </option>
                                <xsl:for-each select="$Form/id_district/row">
                                    <option value="{id}">
                                        <xsl:if test="@active">
                                            <xsl:attribute name="selected">selected</xsl:attribute>
                                        </xsl:if>
                                        <xsl:value-of select="name" />
                                    </option>
                                </xsl:for-each>
                            </select>
                        </li>

                        <li hidden="true">
                            <label>Місто</label>

                            <select name="id_city" id="id_city" class="field">
                                <xsl:if test="not($Form/id_city/row)">
                                    <xsl:attribute name="disabled">disabled</xsl:attribute>
                                </xsl:if>
                                <option value="0">
                                    Не задано
                                </option>
                                <xsl:for-each select="$Form/id_city/row">
                                    <option value="{id}">
                                        <xsl:if test="@active">
                                            <xsl:attribute name="selected">selected</xsl:attribute>
                                        </xsl:if>
                                        <xsl:value-of select="name" />
                                    </option>
                                </xsl:for-each>
                            </select>
                        </li>
                        <li class="submit">
                            <input name="save" type="submit" id="save" style="font-weight: bold;" value="Застосувати" />
                            <br/>
                            <input name="reset" type="submit" id="reset" value="Показати все" />
                        </li>
                    </ul>
                </fieldset>
                </div>
            </form>

        </div>
    </div>
    </xsl:template>
</xsl:stylesheet>